package com.ygxsk.carhome.ui.adapter;

import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.blankj.utilcode.util.ObjectUtils;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.ygxsk.carhome.R;
import com.ygxsk.carhome.response.MyCarNumber;

import java.util.List;

/*
 * @Author:itchenqi175@163.com
 * @Time:2024/3/4  15:10
 * @Description:车辆车牌的适配器，仅仅是车牌的名称 字符串
 */
public class CarNumberAdapter extends BaseQuickAdapter<MyCarNumber, BaseViewHolder> {

    public CarNumberAdapter(int layoutResId, @Nullable List<MyCarNumber> data) {
        super(layoutResId, data);
    }

//    public CarNumberAdapter(int layoutResId) {
//        super(layoutResId);
//    }

    @Override
    protected void convert(@NonNull BaseViewHolder baseViewHolder, MyCarNumber myCarNumber) {

        if (!ObjectUtils.isEmpty(myCarNumber)) {

            //是否被勾中
            boolean isChecked = myCarNumber.isChecked();
            //填充名称：
            String carNumberName = myCarNumber.getDictLabel();

            TextView textViewCarNumbername = (TextView) baseViewHolder.getView(R.id.textviewcarnumbername);
            ImageView checkBoxInCardNumber = (ImageView) baseViewHolder.getView(R.id.checkboxincardnumber);


            textViewCarNumbername.setText(carNumberName);

            if (isChecked) {//表示选中

                //字体设置为选中
//              textViewStationNameType.setTextColor(ColorUtils.getColor(R.color.orangeygxsk));
//                textViewStationNameType.setTextColor(ColorUtils.getColor(R.color.redcomm));
                checkBoxInCardNumber.setVisibility(View.VISIBLE);

            } else {

//                textViewStationNameType.setTextColor(ColorUtils.getColor(R.color.dark));
                checkBoxInCardNumber.setVisibility(View.INVISIBLE);
            }

        }

    }
}
